package com.mobike.android

import android.content.Context
import android.content.res.Resources
import android.graphics.drawable.BitmapDrawable
import android.support.annotation.ColorRes
import android.support.annotation.DrawableRes
import android.support.annotation.StringRes
import com.android.basic.androidApp
import com.mobike.android.app.androidApp


val res = androidApp.resources!!

val displayMetrics = res.displayMetrics!!

inline fun string(@StringRes i: Int) = res.getString(i)!!
inline fun string(@StringRes i: Int, vararg formatArgs: Any?) = res.getString(i, *formatArgs)!!
inline fun resText(i: Int) = res.getText(i)!!

@Suppress("DEPRECATION")
inline fun drawable(@DrawableRes i: Int) = res.getDrawable(i)!!

@Suppress("DEPRECATION")
inline fun bitmap(@DrawableRes i: Int) = (res.getDrawable(i) as BitmapDrawable).bitmap!!

inline fun color(@ColorRes i: Int) = res.getColor(i)

